<?php

include_once '../util/db/Conn.php';
include_once '../util/ArrayList.php';

include_once '../util/db/model/ProdType.php';


class prodTypeDBUtil {
	protected $dbConn;
	private $tabName = "prod_type";
	function __construct() {
		$this->dbConn = new DBConn ();
		header ( "Content-Type:text/html; charset=utf-8" );
	}
	
	public function open() {
		$this->dbConn->open ();
	
	}
	
	public function close() {
		$this->dbConn->close ();
	}
	
	public function queryAll() {
		$this->open ();
		$arrayList = new ArrayList ();
		$sql = "select * from `$this->tabName`";
		$result = mysql_query ( $sql );
		while ( $row = @mysql_fetch_array ( $result ) ) {
			$arrayList->add ( $this->fill ( $row ) );
		}
		$this->close ();
		return $arrayList;
	}
	
	/**
	 * Enter description here ...
	 */
	private function fill($row) {
		$prodType = new ProdType ();
		$prodType->setPt_id ( $row ['pt_id'] );
		$prodType->setType( $row ['type'] );
		return $prodType;
	}
	

}
?>